home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Texteditors / Origami / Sources / src / lib / ori_re_lib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-27  |  1.5 KB  |  37 lines

  1. #ifndef ORI_RE_LIB_READ
  2. #  define ORI_RE_LIB_READ
  3. #  include "bregex.h"
  4.    /*{{{}}}*/
  5.    /*{{{  maybe, regexec needs the length of the string*/
  6. #   ifdef RE_STRLEN
  7. #     undef regexec
  8. #     define regexec(p,s,n,m,f) bregexec((p),(s),strlen(s),(n),(m),(f))
  9. #   endif
  10.    /*}}}  */
  11.    /*{{{  maybe limit the number of subexpressions*/
  12. #   ifdef REG_NSUBMAX
  13. #     define USE_SUB_LIMIT(x,p) ((p).re_nsub=(x),REG_NSUBMAX)
  14. #   else
  15. #     define USE_SUB_LIMIT(x,p) 0
  16. #   endif
  17.    /*}}}  */
  18.    /*{{{  maybe use NOSUB, while only searching*/
  19. #   define USE_NOSUB(repl)  ((repl)?0:REG_NOSUB)
  20.    /*}}}  */
  21.    /*{{{  get error from regcomp/exec*/
  22. #   define REG_ERR_OFF(preg) ((preg).re_erroffset)
  23. #   define REG_ERR_TAG(e) ((e)==REG_ECOLLATE?(char*)"collation":  \
  24.                            (e)==REG_ECTYPE  ?(char*)"class":      \
  25.                            (e)==REG_EESCAPE ?(char*)"\\":         \
  26.                            (e)==REG_ESUBREG ?(char*)"\\x":        \
  27.                            (e)==REG_EBRACK  ?(char*)"[]":         \
  28.                            (e)==REG_EPAREN  ?(char*)"()":         \
  29.                            (e)==REG_EBRACE  ?(char*)"{}":         \
  30.                            (e)==REG_BADBR   ?(char*)"repeat":     \
  31.                            (e)==REG_ERANGE  ?(char*)"range":      \
  32.                            (e)==REG_ESPACE  ?(char*)M_NO_MEMORY:  \
  33.                            (e)==REG_BADRPT  ?(char*)"*+?!":       \
  34.                                              (char*)"failed")
  35.    /*}}}  */
  36. #endif
  37.